let setIn = null;
let elem=null;
function start(ele) {
	elem=ele;
    let height = ele.children[0].clientHeight
    // let count = ele.children.length
    // let index = 0
    // console.log("start");
    // console.log(ele);
    clearInterval(setIn);
    elem.removeEventListener("transitionend", iniEle);
    setIn = setInterval(() => {
        ele.style.transition = "transform 0.5s linear";
    	ele.style.webkitTransition = "transform 0.5s linear";
    	// ele.style.marginTop="-"+height+"px";
    	ele.style.transform = "translateY(-" + height + "px)";
    },3000)
    
    ele.addEventListener("transitionend", iniEle);
}

function iniEle(){
    	elem.style.transition = "";
    	elem.style.webkitTransition = "";
        var first = elem.children[0];
		elem.children[0].remove();
		elem.appendChild(first);
		// elem.style.marginTop=0;
    elem.style.transform = "translateY(0px)";
}

function stop() {
    // console.log("???");
    if(elem) {
        clearInterval(setIn);
        elem.removeEventListener("transitionend", iniEle);
        elem.style.transform = "translateY(0px)";
        setIn = null;
        elem = null;
    }
}

export default {
    start: start,
    stop: stop
}
